# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => 'ee98e10824eee279da4d21494a24f825'
    protected
    def render_json(json, options={})
      callback, variable = params[:callback], params[:variable]
      response = begin
        if callback && variable
          "var {variable} = {json};\n{callback}({variable});"
        elsif variable
          "var {variable} = {json};"
        elsif callback
          "{callback}({json});"
        else
          json
        end
      end
      render({:content_type => :js, :text => response}.merge(options))
    end
  private
  def authorize
#    unless User.find_by_id(session[:user_id]) 
 #     #redirect_to(:controller => "login" , :action => "logoutstatus" )
  #     render({:content_type => :js, :text => "notlogin"})
   # end
  end
    
end
